<template>
  <div class="container">
    <div class="head">
      <span>个人中心</span>
    </div>
    <div class="content">
      <div class="title">
        修改密码
      </div>
      <el-input show-password placeholder="请输入旧密码" v-model="entity.adminPassword">
        <template slot="prepend">旧密码</template>
      </el-input>
      <el-input show-password placeholder="请输入新密码" v-model="entity.adminNewPassword">
        <template slot="prepend">新密码</template>
      </el-input>
      <el-input show-password placeholder="请输入验证新密码" v-model="entity.adminAgainNewPassword">
        <template slot="prepend">新密码</template>
      </el-input>
    </div>
    <el-button plain type="danger" @click="updateAdminPassword">修改</el-button>
  </div>
</template>
<script>
import {AdminUpdatePassword} from "@/api";
import Store from "@/store";

export default {
  name: "Oneself",
  data(){
    return{
      entity: {
        adminPassword: '',
        adminNewPassword: '',
        adminAgainNewPassword: ''
      }
    }
  },
  methods: {
    updateAdminPassword(){
      AdminUpdatePassword(this.entity).then(res => {
        Store.commit("delAdminTokenValue")
        this.$notify({
          title: res.message,
          type: "success"
        })
        this.$router.push("/admin")
      })
    }
  }
}
</script>


<style scoped lang="less">
.container{
  background: #e8e6e6;
  border-radius: 8px;
  margin: 16px 128px;
  padding: 16px;
  min-width: 560px;
  .content{

    width: 32%;
    margin: auto;
    .title{
      font-weight: 600;
      font-size: 18px;
    }
    /deep/ .el-input{
      margin: 8px 0;
    }
  }
  .head{
    span{
      font-weight: 600;
      color: darkgrey;
    }
    display: flex;
    justify-content: space-between;
    margin-right: 80px;
    margin-bottom: 24px;
    align-items: center;
  }
  .hotel-info{
    width: 50%;
    min-width: 480px;
    margin: auto;
    /deep/.el-input{
      margin: 8px 0;
    }
  }
}
</style>